home *** CD-ROM | disk | FTP | other *** search
- class classes.fx.ShrapnelB
- {
- var x;
- var y;
- var dir;
- var id;
- var clip;
- var xMov;
- var yMov;
- var rotateVar;
- var rotateInt;
- var yank;
- var c = 0;
- var Name = "shrapnelB";
- function ShrapnelB(px, py, pdir, pid)
- {
- this.x = px;
- this.y = py;
- this.dir = pdir;
- this.id = pid;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("shrapnelB","shrapnelB" + this.id + "Clip",_root.d + 75000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- if(this.dir == "U")
- {
- this.xMov = _root.randRange2(-6,6);
- this.yMov = _root.randRange2(-6,0);
- }
- else if(this.dir == "D")
- {
- this.xMov = _root.randRange2(-6,6);
- this.yMov = _root.randRange2(0,6);
- }
- else if(this.dir == "L")
- {
- this.xMov = _root.randRange2(-6,0);
- this.yMov = _root.randRange2(-6,6);
- }
- else
- {
- this.xMov = _root.randRange2(0,6);
- this.yMov = _root.randRange2(-6,6);
- }
- this.rotateVar = random(2) <= 0 ? -1 : 1;
- this.rotateInt = _root.randRange(3,7);
- }
- function main()
- {
- this.c = this.c + 1;
- if(this.c / this.rotateInt == Math.round(this.c / this.rotateInt))
- {
- this.clip._rotation += 90 * this.rotateVar;
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(30,60),_root.randRange(70,100)]);
- _root[_root.char].hit(this.xMov,this.yMov,100,15);
- this.yank = true;
- }
- var _loc4_ = 0;
- var _loc6_ = _root.broShots.length;
- while(_loc4_ < _loc6_)
- {
- var _loc5_ = _root.broShots[_loc4_] + "Clip";
- if(this.clip.hitTest(_root[_loc5_]))
- {
- _root.createExploA([this.x,this.y,_root.randRange(30,70),_root.randRange(75,100)]);
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar - 1;
- var _loc3_ = _root.broShots[_loc4_];
- _root[_loc3_].exploX = this.x + this.clip.body._width / 2;
- _root[_loc3_].exploY = this.y + this.clip.body._height / 2;
- _root[_loc3_].hit();
- this.yank = true;
- break;
- }
- _loc4_ = _loc4_ + 1;
- }
- if(this.c > 100)
- {
- if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
- {
- this.yank = true;
- }
- }
- if(this.yank)
- {
- _root.removeFX("shrapnelB" + this.id);
- }
- this.x += this.xMov;
- this.y += this.yMov;
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-